package Day09;

import java.util.ArrayList;

public class DemoArraylist01 {
    public static void main(String[] args) {
/*  //public boolean remove(Object o)：删除指定的元素，返回删除是否成功
//        System.out.println(array.remove("world"));
//        System.out.println(array.remove("javaee"));
        //public E remove(int index)：删除指定索引处的元素，返回被删除的元素
//        System.out.println(array.remove(1));
        //IndexOutOfBoundsException
//        System.out.println(array.remove(3));
        //public E set(int index,E element)：修改指定索引处的元素，返回被修改的元素
//        System.out.println(array.set(1,"javaee"));
        //IndexOutOfBoundsException
//        System.out.println(array.set(3,"javaee"));
        //public E get(int index)：返回指定索引处的元素*/
        ArrayList<String> array = new ArrayList<String>();
        array.add("hello");
        array.add("java");
        array.add("123");
//        System.out.println(array.remove("123"));true
//        System.out.println(array.remove("211"));//false
//        System.out.println(array.remove(1));//java
//        System.out.println(array.remove(3));IndexOutOfBoundsException
//        System.out.println(array.set(2,"321"));123
//        System.out.println(array.get(0));//hello
        System.out.println(array.size());//3
        System.out.println("array:"+array);
    }
}
